﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace RSSReader.classesCustom
{
    //private Int32 _ID;
    //private Int32 _siteID;
    //private String  _logo;
    //private String _category;
    //private String _title;
    //private DateTime _pubdate;
    //private String _description;
    //private String _fullarticle;
    //private String _weblink;
    public class ArticleSortOptions
    {
        byte byId { get; set; }
        byte byLogo { get; set; }
        byte byCategory { get; set; }
        byte byTitle { get; set; }
        byte byPubdate { get; set; }
    }

    public class ArticleSorter
    {
        readonly ArticleSortOptions options;
        readonly List<Article> articleList;

        public ArticleSorter(ArticleSortOptions opt, List<Article> artList)
        {
            this.options=opt;
            this.articleList = artList;
        }

        public List<Article> getSortedList()
        {
            string s = "l.pubdate descending, l.ID descending";

            //List<Article> x = articleList.OrderBy(e=>e.ID,desc).ToList();
            var x = (from l in articleList
                    orderby l.ID descending, l.pubdate descending
                    select l).ToList();
            var y = (from l in articleList
                     orderby s
                     select l).ToList();
            return (List<Article>)x;
        }
    }
}